package com.justnow.offer.usejdk;


import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

/**
 * @author justnow
 * Created on 2020-09-05
 * Description
 */
public class JdkClient {
    public static void main(String[] args) {
        IHelloService target = new HelloService();
        JdkInvocationHandler handler = new JdkInvocationHandler(target);
        IHelloService helloService = (IHelloService)Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), handler);
        helloService.sayHello();
        helloService.sayBye();
    }
}
